#! /bin/bash
#yum config
#v1.0 by wangtao 2019/01/13
yum_server=192.168.1.101
os_version=`cat /etc/redhat-release |awk '{print $(NF-1)}'|awk -F "." '{print $1"."$2}'`
[ -d /ets/yum.repos.d ] || mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
if [ "$os_version" = "7.3" ];then
	cat >/etc/yum.repos.d/centos7.repo <<-EOF
	[centos7u3]
	name=centos7u3
	baseurl=ftp://$yum_server/centos7u3
	gpgcheck=0
	EOF
elif [ "$os_version" = "6.10" ];then
	wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
	echo "6.10 yum config"
elif [ "$os_version" = "5.9" ];then
        cat >/etc/yum.repos.d/centos5u9.repo <<-EOF
        [centos5u9]
        name=centos5u9
        baseurl=ftp://$yum_server/centos5u9
        gpgcheck=0
	EOF
else
	echo "error"
fi
